package work.jame.blog.configuration.web;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author : Jame
 * @date : 2022-09-08 08:52
 **/
@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("work.jame.blog.controller"))
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfo(
                "博客",
                "接口文档",
                "1.0",
                "http://localhost:8877/",
                "Jame",
                "Apache 2.0",
                "null");
    }

}
